var formatWithArray = function (number) {
  var arr = (number + '').split('.')
  var int = arr[0].split('')
  var fraction = arr[1] || ''
  var r = ''
  var len = int.length // eslint-disable-line no-unused-vars
  int.reverse().forEach(function (v, i) {
    if (i !== 0 && i % 3 === 0) {
      r = v + ',' + r
    } else {
      r = v + r
    }
  })
  return r + (!fraction ? ' ' + fraction : '')
}
export default formatWithArray
